package com.maoyanjava.controller;

import com.maoyanjava.pojo.Plan;
import com.maoyanjava.service.PlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
public class PlanController {
    @Autowired
    private PlanService ps;
    //获取全部
    @GetMapping("/plan")
    public List<Plan> getAllPlan(HttpServletRequest request, HttpServletResponse response){
        List<Plan> list =ps.getAllPlanAndRCF();
        return list;
    }
    //购买页面 no座位
    @GetMapping("/planone")
    public Plan getplanone(HttpServletRequest request, HttpServletResponse response){
        String id = request.getParameter("id");
        Plan p=ps.getOne(Integer.parseInt(id));
        return p;
    }
}
